<?php
namespace App\Models;
use CodeIgniter\Model;

class Student extends Model
{

    public static function Custom()
    {
        return [
            'var1' => 'bianliang1',
            'var2' => 'bianliang2',
            'var3' => 'bianliang3',
            'var4' => 'bianliang4'
        ];
    }

    protected $table = 'students';

    protected $primaryKey = 'id';

    // object
    protected $returnType = 'array';

    protected $useSoftDeletes = true;

    protected $allowedFields = [
        'name',
        'email'
    ];

    protected $useTimestamps = false;

    protected $createdField = 'created_at';

    protected $updatedField = 'updated_at';

    protected $deletedField = 'deleted_at';

    protected $validationRules = [
        'username' => 'required',
        'password' => 'required',
        'pass_confirm' => 'required|matches[password]|is_unique[users.email,id,{id}]',
        'email' => 'required|valid_email'
    ];

    protected $validationMessages = [
        'username' => [
            'required' => 'You must choose a username.'
        ],
        'email' => [
            'valid_email' => 'Please check the Email field. It does not appear to be valid.'
        ]
    ];

    protected $skipValidation = false;
}